home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / CODE / Chap08 / Paint4 / Paint4.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  1.3 KB  |  55 lines

  1. //***********************************************************************
  2. //
  3. //  Paint4.cpp
  4. //
  5. //***********************************************************************
  6.  
  7. #include <afxwin.h>
  8. #include "Resource.h"
  9. #include "CLine.h"
  10. #include "Paint4.h"
  11. #include "MainFrame.h"
  12. #include "Paint4Doc.h"
  13. #include "Paint4View.h"
  14. #include "AboutDlg.h"
  15.  
  16. CPaintApp myApp;
  17.  
  18. BEGIN_MESSAGE_MAP (CPaintApp, CWinApp)
  19.     ON_COMMAND (ID_FILE_NEW, CWinApp::OnFileNew)
  20.     ON_COMMAND (ID_FILE_OPEN, CWinApp::OnFileOpen)
  21.     ON_COMMAND (ID_APP_ABOUT, OnAppAbout)
  22. END_MESSAGE_MAP ()
  23.  
  24. BOOL CPaintApp::InitInstance ()
  25. {
  26.     SetRegistryKey ("Programming Windows 95 with MFC");
  27.     LoadStdProfileSettings ();
  28.  
  29.     CSingleDocTemplate* pDocTemplate;
  30.     pDocTemplate = new CSingleDocTemplate (
  31.         IDR_MAINFRAME,
  32.         RUNTIME_CLASS (CPaintDoc),
  33.         RUNTIME_CLASS (CMainFrame),
  34.         RUNTIME_CLASS (CPaintView)
  35.     );
  36.  
  37.     AddDocTemplate (pDocTemplate);
  38.     RegisterShellFileTypes (TRUE);
  39.  
  40.     CCommandLineInfo cmdInfo;
  41.     ParseCommandLine (cmdInfo);
  42.  
  43.     if (!ProcessShellCommand (cmdInfo))
  44.         return FALSE;
  45.  
  46.     m_pMainWnd->DragAcceptFiles ();
  47.     return TRUE;
  48. }
  49.  
  50. void CPaintApp::OnAppAbout ()
  51. {
  52.     CAboutDialog dlg;
  53.     dlg.DoModal ();
  54. }
  55.